/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package plan;

import java.awt.Color;
import java.awt.Component;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.border.Border;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;

/**
 *
 * @author phucan
 */
public class RowHeader extends JLabel implements TableCellRenderer {

    Color bgColor;
    Border b ;
    int[][] mark=new int[48][8];

    public RowHeader() {
       // super();

        //this.setBorder(BorderFactory.createLineBorder(Color.gray,1));
         b=BorderFactory.createBevelBorder(NORTH_WEST);
        this.setBorder(b);
        // this.setBackground(Color.red);
        setOpaque(true);
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
     this.setBackground(Color.getHSBColor(128, 128, 128));
     if(row%4==0){
         this.setForeground(Color.black);
     }else{
         this.setForeground(Color.gray);
     }
     this.setAlignmentX(RIGHT_ALIGNMENT);
      if (value == null) {
            return this;
        } else if (value instanceof String) {
            setText(value.toString());
        } else {
            setText("");
        }
        return this;
    }


    public void setBackgroundColor(Color bg) {
        this.bgColor = bg;
    }
    public void setMark(int row, int col,int value){
        mark[row][col]=value;
    }
}
